import csv
def read_csv(file_path):
    with open(file_path,"r",encoding="gbk") as f:
        reader=csv.reader(f)
        headers=next(reader)
        data={}
        for row in reader:
            province=row[0].strip()
            data[province]={header:value for header,value in zip(headers[1:],row[1:])}
        return headers,data

def main():
    headers,data=read_csv("xiaofei.csv")
    province=input("请输入省份：").strip()
    query_items=input("请输入要查询的项目（多个用逗号分隔）:").strip().split(',')

    if province not in data:
        print("省份不存在！")
        return
    result={}
    for item in query_items:
        item=item.strip()
        if item in headers[1:]:
            result[item]=data[province].get(item,"无数据")
        else:
            result[item]="项目不存在"

    print("\n查询结果:")
    for k,v in result.items():
        print(f"{k}:{v}")

if __name__=="__main__":
    main()